package org.example.controller;

import org.example.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import  org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.client.RestTemplate;


import java.util.Map;

@RestController
public class BeaconApiController {


    @Autowired
    private RedisTemplate redisTemplate;




    // 写测试 hash结构
    @PostMapping("/test/set/{key}")
    public String set(@PathVariable String key, @RequestBody Map map){
        redisTemplate.opsForHash().putAll(key,map);
        return "ok";
    }



    // 读测试
    @GetMapping("/test/get/{key}")
    public R get(@PathVariable String key){
        Map<Object, Object> result = redisTemplate.opsForHash().entries(key);
        return R.ok();
    }
}
